package com.joshua.spring.entity.em;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * projectName dragon-cloud
 * package com.joshua.spring.entity.em
 * classname  JobOptTypeEnum
 * <p>
 * description
 * </p>
 *
 * @author <a href="mailto:joshualwork@163.com">joshua_liu</a>
 * @date 2020/9/13 10:06
 */
@Getter
@AllArgsConstructor
public enum JobOptTypeEnum {
    //暂停
    PAUSE("pause"),
    //删除
    DELETE("delete"),
    //恢复
    RESUME("resume"),
    //立即执行
    TRIGGER("trigger"),
    //没有
    DEFAULT("null"),
    ;
    private String code;

    public static JobOptTypeEnum getInstanceByCode(String code) {
        JobOptTypeEnum[] values = JobOptTypeEnum.values();
        int enumSize = values.length;
        for (int i = 0; i < enumSize; i++) {
            if (values[i].code.equals(code)) {
                return values[i];
            }
        }
        return JobOptTypeEnum.DEFAULT;
    }
}

